//
//  AXHomeZjzdIntroCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/29.
//  Copyright © 2018年 tzhg. All rights reserved.
//
/** 专家个人简介 */
#import "AXHomeZjzdIntroCell.h"
#import "ZXCategories.h"
#import "UITableView+SDAutoTableViewCellHeight.h"
#import "UIView+SDAutoLayout.h"
#import "UIImageView+WebCache.h"

@interface AXHomeZjzdIntroCell ()

@end

@implementation AXHomeZjzdIntroCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
    
        [self creatView];
        
    }
    return self;
}

- (void)creatView {
    
    self.introlLabel = [[UILabel alloc]init];
    self.introlLabel.textColor = COLOR_DIV;
    self.introlLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.introlLabel];
   
    /** 专家图片 */
    self.specialistImg = [[UIImageView alloc]init];
    self.specialistImg.backgroundColor = [UIColor redColor];
    self.specialistImg.cornerRadius = 30;
    self.specialistImg.contentMode =UIViewContentModeScaleAspectFill;
    self.specialistImg.clipsToBounds=YES;//
    [self.contentView addSubview:self.specialistImg];
    
    /** 专家名字 */
    self.specialistNameLabel = [[UILabel alloc]init];
    self.specialistNameLabel.textColor = COLOR_DIV;
    self.specialistNameLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.specialistNameLabel];
    
    /** 性别 */
    self.specialistSexLabel = [[UILabel alloc]init];
    self.specialistSexLabel.textColor = COLOR_DIV;
    self.specialistSexLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.specialistSexLabel];
    /** 职称 */
    self.jobTitleLabel = [[UILabel alloc]init];
    self.jobTitleLabel.textColor = COLOR_DIV;
    self.jobTitleLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.jobTitleLabel];
    /** 大学 */
    self.universityLabel = [[UILabel alloc]init];
    self.universityLabel.textColor = COLOR_DIV;
    self.universityLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.universityLabel];
   
    /** 擅长*/
    self.wellLabel = [[UILabel alloc]init];
    self.wellLabel.textColor = COLOR_DIV;
    self.wellLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.wellLabel];
    
    self.wellCropLabel = [[UILabel alloc]init];
    self.wellCropLabel.textColor = COLOR_DIV;
    self.wellCropLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.wellCropLabel];
    
  
    /** 在线状态*/
    self.serveLabel = [[UILabel alloc]init];
    self.serveLabel.textAlignment = NSTextAlignmentLeft;
    self.serveLabel.textColor = COLOR_ORG;
    self.serveLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.serveLabel];
    
}

- (void)setlayout {
    
  
 
    
    /** 专家图片 */
    self.specialistImg.sd_layout
    .rightSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(70)
    .heightIs(70);
    
    /** 个人简介 */
    self.introlLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(SCREEN_WIDTH-100)
    .heightIs(20);
    
    /** 专家名字 */
    self.specialistNameLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.introlLabel, 10)
    .widthIs(SCREEN_WIDTH-100)
    .heightIs(20);
    /** 性别 */
    self.specialistSexLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.specialistNameLabel, 10)
    .widthIs(100)
    .heightIs(20);
    /** 职称 */
    self.jobTitleLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.specialistSexLabel, 10)
    .widthRatioToView(self.specialistNameLabel, 1)
    .heightIs(20);
    
    /** 大学 */
    self.universityLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.jobTitleLabel, 10)
    .widthRatioToView(self.specialistNameLabel, 1)
    .heightIs(20);
    
    /** 擅长 领域*/
    self.wellLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.universityLabel, 10)
    .widthIs(SCREEN_WIDTH-20)
    .autoHeightRatio(0)
    .minHeightIs(20);
    
    self.wellCropLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.wellLabel, 10)
    .widthIs(SCREEN_WIDTH-80)
    .autoHeightRatio(0)
    .minHeightIs(20);
    
    /** 服务星级 */
    self.serveLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.wellCropLabel, 10)
    .widthIs(SCREEN_WIDTH-20)
    .heightIs(20);

    
    [self setupAutoHeightWithBottomView:self.serveLabel bottomMargin:10];
   
}


- (void)setModel:(AXHomeZjzdIntroModel *)model {
    
    _model = model;
    
    /** 个人简介 */
    self.introlLabel.text = [NSString stringWithFormat:@"个人简介:%@",_model.fIntroduce];
    /** 专家图像 */
    [self.specialistImg sd_setImageWithURL:[NSURL URLWithString:_model.self.fIntroduce] placeholderImage:[UIImage imageNamed:@""]];
    /** 姓名 */
    self.specialistNameLabel.text = [NSString stringWithFormat:@"姓名:%@",_model.self.fExpertName];
    /** 性别 */
     self.specialistSexLabel.text = _model.self.fSexCHS;
    /** 职称 */
     self.jobTitleLabel.text =_model.self.fPositionalTitleName;
    /** 学校 */
    self.universityLabel.text = [NSString stringWithFormat:@"学校:%@",_model.self.fCompanyName];
    /** 擅长领域 */
     self.wellLabel.text = [NSString stringWithFormat:@"擅长领域:%@",_model.self.fExcelDomainName];
    /** 擅长作物 */
     self.wellCropLabel.text =[NSString stringWithFormat:@"擅长作物:%@",_model.self.fExcelCropName];
    /** 满意度 */
     self.serveLabel.text =[NSString stringWithFormat:@"满意度:%@",_model.self.fSatisfiedPer];
    
    [self setlayout];
    
}

@end
